﻿package view.tips
{
    import com.sh.game.display.*;
    import com.sh.game.global.*;
    import flash.display.*;
    import flash.geom.*;
    import morn.core.handlers.*;

    public class TipsEffect extends Sprite
    {
        private var xml:XML;
        private var _quality:int = -1;
        private var _showRec:Rectangle;
        private var _mc:XMLMovieClip;
        private var _xml:XML;
        private var _movieQuality:int = -1;
        private static var initImg:Boolean = false;
        private static var group2Class:Class = TipsEffect_group2Class;
        private static var group3Class:Class = TipsEffect_group3Class;
        private static var group4Class:Class = TipsEffect_group4Class;
        private static var group5Class:Class = TipsEffect_group5Class;
        private static var group6Class:Class = TipsEffect_group6Class;
        private static var _xmlQuality:Array;
        private static var _bmpArr:Array = new Array();

        public function TipsEffect(param1:int = 0)
        {
            if (!_xmlQuality)
            {
                _xmlQuality = [new XML(new group2Class()), new XML(new group3Class()), new XML(new group4Class()), new XML(new group5Class()), new XML(new group6Class())];
            }
            this.mouseChildren = false;
            this.mouseEnabled = false;
            this.blendMode = BlendMode.ADD;
            this.show(param1);
            return;
        }// end function

        private function onComplete(param1:int, param2:BitmapData) : void
        {
            var _loc_3:XMLClipData = null;
            if (!_bmpArr[param1 - 2])
            {
                _bmpArr[param1 - 2] = new XMLClipData(param2, _xmlQuality[param1 - 2], true);
            }
            if (this._quality != param1)
            {
                return;
            }
            this._movieQuality = 0;
            if (this._mc)
            {
                if (this._mc.parent)
                {
                    this._mc.parent.removeChild(this._mc);
                }
                this._mc = null;
            }
            _loc_3 = _bmpArr[this._quality - 2];
            if (_loc_3 != null)
            {
                this._mc = new XMLMovieClip(_loc_3, null);
                this.addChild(this._mc);
                this._mc.interval = 200;
                this._movieQuality = param1;
                this._mc.x = -226;
                this._mc.y = -226;
            }
            if (this._quality > 1)
            {
                if (this._showRec)
                {
                    this.setSize(this._showRec.width, this._showRec.x, this._showRec.y);
                    this._showRec = null;
                }
            }
            return;
        }// end function

        public function show(param1:int) : void
        {
            var _loc_2:XMLClipData = null;
            this._quality = param1;
            if (this._quality > 1)
            {
                if (param1 == this._movieQuality)
                {
                    return;
                }
                this._movieQuality = 0;
                if (this._mc)
                {
                    if (this._mc.parent)
                    {
                        this._mc.parent.removeChild(this._mc);
                    }
                    this._mc = null;
                }
                _loc_2 = _bmpArr[this._quality - 2];
                if (_loc_2 == null)
                {
                    App.mloader3.loadBMD(Config.getUrl("assets/images/avtiveIcon/group" + this._quality + ".png"), 1, new Handler(this.onComplete, [this._quality]), null, null, true);
                }
                else
                {
                    this._mc = new XMLMovieClip(_bmpArr[param1 - 2], null);
                    this.addChild(this._mc);
                    this._mc.interval = 200;
                    this._movieQuality = param1;
                    this._mc.x = -226;
                    this._mc.y = -226;
                }
            }
            else if (this._mc)
            {
                if (this._mc.parent)
                {
                    this._mc.parent.removeChild(this._mc);
                }
                this._mc = null;
                this._movieQuality = 0;
            }
            return;
        }// end function

        public function dispose() : void
        {
            this._movieQuality = 0;
            if (this._mc)
            {
                if (this._mc.parent)
                {
                    this._mc.parent.removeChild(this._mc);
                }
                this._mc = null;
            }
            this._showRec = null;
            this._quality = 0;
            this._movieQuality = 0;
            return;
        }// end function

        public function setSize(param1:Number, param2:int, param3:int) : void
        {
            if (this._mc)
            {
                if (param1 != 1)
                {
                    var _loc_4:* = param1;
                    this.scaleY = param1;
                    this.scaleX = _loc_4;
                }
            }
            else
            {
                this._showRec = new Rectangle(param2, param3, param1, param1);
            }
            return;
        }// end function

    }
}
